﻿@{
    ViewBag.Title = "Material Management";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <style>
        fieldset {
            border: 1px solid #DDD;
            padding: 0 1.4em 1.4em 1.4em;
            margin: 0 0 1.5em 0;
        }

        .control-group {
            float: left;
            margin-bottom: 10px;
            width: 45%;
        }

        .control-group30 {
            float: left;
            margin-bottom: 10px;
            width: 30%;
        }

        .control-group90 {
            float: left;
            margin-bottom: 10px;
            width: 90%;
        }

        .field {
            margin-left: 110px;
            position: relative;
        }

        .field90 {
            padding: 5px 15px 0 20px;
            position: relative;
        }

        .label100 {
            width: 100px;
        }

        .section {
            margin-top: 5px;
            margin-left: 10px;
        }
    </style>
    <script src="~/Scripts/gbh/Material.js"></script>
}

<h2>Material Management</h2>

<label class="label-bold label100">
    ค้นหา Material:
</label>
<input type="text" id="MaterialSearchId" class="easyui-textbox" />
<input id="MaterialSearchButton" value="Search" onclick="MaterialSearch();" type="button" />
<input id="MaterialSearchButton" value="Advance Search" onclick="openSearchProduct();" type="button" />


<div class="easyui-layout" style="width: 100%; height: 90%">
    <div data-options="region:'east'" title="Enable  Branch" style="width: 250px;">
        <table id="branchAll" title="" class="easyui-datagrid" style="width: auto; height: 400px;"
            rownumbers="true" toolbar="#toolbar" fitcolumns="true">
            <thead>
                <tr>
                    <th field="ck" checkbox="true"></th>

                    <th field="mbranchno" width="30" align="center">Branch No.
                    </th>
                    <th field="mprovdesc" width="40" align="center" sortable="true">Branch Name
                    </th>
                </tr>
            </thead>
        </table>
    </div>
    <div data-options="region:'center',iconCls:'icon-ok'">
        <div>
            <form id="materialform">
                <div class="section">
                    <div class="control-group">
                        <label class="label-bold label100">
                            NPI Material:
                        </label>
                        <span>
                            <input data-options="readonly:'true'" type='text' name='mmatno' id='mmatno' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Name Thai:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mmatthai' id='mmatthai' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            NPI Barcode:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='meancode' id='meancode' class='input-xxlarge easyui-textbox' />
                        </span>

                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Name Eng:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mmateng' id='mmateng' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Material Group:
                        </label>
                        <span>
                            <input type='text' name='title' id='matgrp' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                </div>


                <div class="section">
                    <div class="control-group">
                        <label class="label-bold label100">
                            Gross weight:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mgrosswgt' id='mgrosswgt' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Weight Unit:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='munitwgt' id='munitwgt' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Net weight:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mnetwgt' id='mnetwgt' class='input-xxlarge easyui-textbox' />
                        </span>

                    </div>
                    @*   <div class="control-group">
                <label class="label-bold label100">
                    Weight unit:
                </label>
                <span>
                    <input type='text' name='title' id='title' class='input-xxlarge easyui-textbox' />
                </span>
            </div>*@
                    <div class="control-group">
                        <label class="label-bold label100">
                            Volume:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mvolume' id='mvolume' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Volume unit:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='munitvolume' id='munitvolume' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Size:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='msize' id='msize' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group">
                        <label class="label-bold label100">
                            Size unit:
                        </label>
                        <span>
                            <input type='text' name='sizeunit' id='sizeunit' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                </div>
                <div class="section">
                    <div class="control-group90">
                        <label class="label-bold label100">
                            Base unit:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mbaseunitth' id='mbaseunitth' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Package unit:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mpauniten' id='mpauniten' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Quantity per package unit:
                        </label>
                        <span>
                            <input readonly="true" type='text' name='mmatgrppack' id='mmatgrppack' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Package unit size:
                        </label>
                        <span>
                            <input type='text' name='packageunit' id='packageunit' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Set unit:
                        </label>
                        <span>
                            <input type='text' name='setunit' id='setunit' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Quantity per set unit:
                        </label>
                        <span>
                            <input type='text' name='quantitypersetunit' id='quantitypersetunit' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                    <div class="control-group30">
                        <label class="label-bold label100">
                            Set unit size:
                        </label>
                        <span>
                            <input type='text' name='setunitsize' id='setunitsize' class='input-xxlarge easyui-textbox' />
                        </span>
                    </div>
                </div>
            </form>
        </div>
        <div style="clear:both; text-align: left; padding: 5px">
            @*<a href="javascript:void(0)" class="easyui-linkbutton" onclick="Save(true)">Save As Draft</a>*@
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="Save(false)">Save</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()">Cancel & Clear</a>
        </div>
    </div>
</div>

 <div id="productSearch" class="easyui-dialog" style="width: 650px; height: 550px; padding: 10px 20px"
            closed="true" buttons="#dlgNonHr-buttons">
            <div>
                <label>
                    รหัสสินค้า</label>
                <input id="searchProductMatNo" >
                <label>
                    ชื่อสินค้าภาษาไทย</label>
                <input id="searchProductNameThai" >
                <label>
                    ชื่อสินค้าภาษาอังกฤษ</label>
                <input id="searchProductNameEng" >
                  <label>
                    Barcode</label>
                <input id="searchProductBarcode" >
                <div>
                     <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="searchProduct()">ค้นหา</a>
                </div>
            </div>
            <table id="dlgProductSearch" title="ค้นหาสินค้า" class="easyui-datagrid"
                style="width: 600px; height: 500px;"
                rownumbers="true" singleselect="true">
                <thead>
                    <tr>
                        <th field="mmatno" width="150" align="center" sortable="true">รหัสสินค้า
                        </th>
                        <th field="mmatthai" width="200" align="center" sortable="true">ชื่อสินค้า
                        </th>
                        <th field="mmateng" width="200" align="center" sortable="true">ชื่อสินค้า อังกฤษ
                        </th>
                    </tr>
                </thead>
            </table>

        </div>
        <div id="dlgNonHr-buttons">
            <a href="#" class="easyui-linkbutton" iconcls="icon-ok" onclick="selectProduct();">Select</a>
            <a href="#" class="easyui-linkbutton" iconcls="icon-cancel" onclick="javascript:jQuery('#productSearch').dialog('close');">Cancel</a>
        </div>